<div style="float:right;height:30px">
<input onclick="window.location='<?php echo $admin_base_url;?>product/add/<?php echo $cur_page;?>';"  type="button" class="sbtbutton" value="Add product" />
</div>
<!-----------------filter form ----------------------------------->
<form action="<?= $admin_base_url; ?>product/index/" method="post">
<table class="filter" cellspacing="0">
     <tr class='filterhead1'>
    	<td colspan="3"> Filter Options </td>
    </tr>
    <tr class='filterhead2'>
      
        <td> Category </td>
        <td> SubCategory </td>
             
        <td>&nbsp;  </td>
        
    </tr>
	<tr> 
    	<td> 
        <select  id="category" name="parent"> 
        <option value=""> Select </option>
        <?php
		foreach($category as $c)
		{
			echo "<option ";
			if($c['id']==$filter1)
			echo " selected";
			echo " value=".$c['id']."> ".$c['name']."</option>";
		}
		?>
        </select>
			 </td>
               <td>
           <select name="category" id="subcategory">
           </select>
           </td>
          <td>
			 <div class="buttons">
				 <button type="submit" name="search" class="positive" value="save" >
			        <img src="<?php echo $admin_image_path?>icons/apply.png" alt=""/>
                    Search
                 </button> 
                 <a href="<?= $admin_base_url; ?>product/clearFilter?rurl=<?php echo $rurl;?>" class="negative">
			        <img src="<?php echo $admin_image_path?>icons/cross.png" alt=""/>
			        Clear
			   </a>
             </div> 
           </td> 
          
     </tr> 
</table>
</form>
<table class="tbllist">
<tbody>
<tr>
<th class="tbslno">Sl.No</th>
<th class="tbname">Code</th>
<th class="tbname">Name</th>
<th class="tbname">Category</th>
<th class="tbname">Description</th>
<th class="tbname">Size</th>
<th class="tbname">Cost</th>
<th class="tbname">Special Cost</th>


<th class="tbaction">Action</th>
</tr>
<?php 
if(!empty($product)) {
	foreach($product as $key => $record) {
		$style = (++$key%2) ? '' : 'alt'; 
?>	
	<tr class="<?php echo $style;?>">
		<td><?= ($cur_page + $key);?></td>
        <td><?php echo $record['code']?></td>
		<td><?php echo $record['name']?></td>
        <td><?php
		if(!empty($category)) {
	foreach($category as $key => $rec) {
		if($rec['id']==$record['category'])
		echo $rec['name'];
	}}
	?></td>
        <td><?php echo $record['description']?></td>
         <td><?php echo $record['size']?></td>
         <td><?php echo $record['cost']?></td>
         <td><?php echo $record['special_cost']?></td>
		<td>
                 <a rel="facebox" href="<?php echo $admin_base_url;?>product/view/<?php echo $record['id'];?>/<?php echo $cur_page;?>" >
        <img border="0" src="<?php echo $admin_image_path;?>view1.png" alt="" title="View" width="19" height="19"/></a>

		<a href="<?php echo $admin_base_url;?>product/edit/<?php echo $record['id'];?>/<?php echo $cur_page;?>"><img border="0" src="<?php echo $admin_image_path;?>edit1.png" alt="" width="16" height="16"/></a>
		<a href="<?php echo $admin_base_url;?>product/delete/<?php echo $record['id'];?>/<?php echo $cur_page;?>" onclick="return confirm('Do you want to delete this ?');"><img border="0" src="<?php echo $admin_image_path;?>delete1.png" alt="" title="Delete" width="16" height="16"/></a>
		</td>
	</tr>
<?php 
	}
} else {
?>
<tr><td colspan="6">No products available</td></tr>
<?php }?>
</tbody>
</table>
<div class="spacer10 rightText">
<?php 	echo $this->pagination->create_links();?>
</div>